from dataclasses import dataclass
from datetime import datetime
from typing import Optional

@dataclass
class KLineData:
    """K线数据模型"""
    symbol: str
    datetime: datetime  # 北京时间
    datetime_utc: datetime  # UTC时间
    open: float
    high: float
    low: float
    close: float
    volume: float
    amount: float
    
    def to_dict(self):
        """转换为字典"""
        return {
            'symbol': self.symbol,
            'datetime': self.datetime,
            'datetime_utc': self.datetime_utc,
            'open': self.open,
            'high': self.high,
            'low': self.low,
            'close': self.close,
            'volume': self.volume,
            'amount': self.amount
        } 